<template>
  <Teleport to="#app">
    <div class="luckMeet">
      <div class="goback" @click="goHome">回到首页</div>
      <div class="luckBox" v-if="!userinfo.luckMeet">
        <div class="reqList" v-show="reqList.length > 0">
          <div class="title"><span>申请列表</span></div>
          <div class="item itemTitle">
            <div>昵称</div>
            <div>宣言</div>
            <div>当前状态</div>
            <div>申请时间</div>
            <div>操作</div>
          </div>
          <div class="item" v-for="(item, index) in reqList" :key="index">
            <div class="createTime">{{ item.userName }}</div>
            <div class="createTime">{{ item.promise }}</div>
            <div class="createTime">{{ parseStatus(item.status) }}</div>
            <div class="createTime">{{ item.createTime }}</div>
            <div class="core">
              <span class="recall" @click="delLove(item)">撤回</span>
            </div>
          </div>
        </div>
        <div class="luck">
          <input
            type="text"
            v-model="meetData.toUser"
            placeholder="输入对方账号"
          />
          <input
            type="text"
            v-model="meetData.promise"
            placeholder="输入最想告诉她/他的一句话(结缘后将作为宣言展示哦)"
          />
          <div class="core">
            <div class="submit" @click="submitLuck">申请结缘</div>
          </div>
        </div>
      </div>
      <div class="meetBox" v-if="userinfo.luckMeet">
        <div class="meet" v-if="luckData">
          <div class="meetOnline">
            <div class="meetLeft">{{luckData[1].userName}}</div>
            <div class="meetContent">情侣</div>
            <div class="meetRight">{{luckData[2].userName}}</div>
          </div>
          <div class="meetOnline">
            <div class="meetLeft">{{luckData[1].integral}}</div>
            <div class="meetContent">情缘值</div>
            <div class="meetRight">{{luckData[2].integral}}</div>
          </div>
          <div class="meetLine">
            <div class="name">亲密度等级:</div>
            <div class="time">{{gradeFilter(luckData[2].integral+luckData[1].integral)}}级<span style="font-size:12px;color:#999;">(发说说能快速提升等级哦)</span></div>
          </div>
          <div class="meetLine">
            <div class="name">称号:</div>
            <div class="honoy">
              <span v-for="(item,index) in honoyFilter(luckData[2].integral+luckData[1].integral)" @mouseleave="honoyLeave(item,index)" @mousemove="honoyHover(item,index)" :key="item.arrive" :style="item.style">{{item.name}}</span>
            </div>
          </div>
          <div class="meetLine">
            <div class="name">纪念日:</div>
            <div class="time">{{luckData[0].createTime}}</div>
          </div>
          <div class="meetLine">
            <div class="name">爱的宣言:</div>
            <div class="time">{{luckData[0].promise}} </div>
          </div>
        </div>
      </div>
    </div>
  </Teleport>
</template>

<script>
import { toRefs, onMounted } from "vue";
import luckMeetJS from "./luckMeet.js";
export default {
  name: "meet",
  setup() {
    let {
      userinfo,
      status,
      methodFun: { getLove, submitLuck, delLove, parseStatus, goHome,gradeFilter,honoyFilter,honoyHover,honoyLeave },
    } = luckMeetJS();
    let { meetData,luckData, reqList } = toRefs(status);
    onMounted(() => {
      getLove();
    });
    return {
      goHome,
      submitLuck,
      parseStatus,
      delLove,
      gradeFilter,
      honoyFilter,
      honoyHover,
      honoyLeave,
      userinfo,
      meetData,
      reqList,
      luckData
    };
  },
};
</script>

<style lang="less" scoped>
.luckMeet {
  position: absolute;
  left: 0px;
  top: 0px;
  width: 100%;
  height: 100%;
  background-image: url("../../../static/images/2.jpg");
  background-color: rgba(0, 0, 0, 0.4);
  .goback {
    position: absolute;
    right: 30px;
    top: 10px;
    cursor: pointer;
    border: 1px solid red;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: "kaiti";
    &:hover {
      box-shadow: 0px 0px 10px 2px red;
      text-shadow: 0px 0px 2px palevioletred;
    }
  }
  .luckBox {
    width: 100%;
    height: 100%;
    .reqList {
      .title {
        height: 40px;
        span {
          padding: 10px 20px;
          border-bottom: 3px solid pink;
        }
      }
      .item {
        height: 40px;
        display: flex;
        align-items: center;
        .core {
          .recall {
            font-size: 14px;
            padding: 4px 14px;
            border: 1px solid palegoldenrod;
            transition: all 0.5s;
            &:hover {
              background-color: palevioletred;
              color: whitesmoke;
            }
          }
        }
        div {
          flex: 1;
          text-align: center;
        }
      }
      .itemTitle {
        border-bottom: 1px solid palevioletred;
      }
    }
    .luck {
      position: absolute;
      width: 30%;
      height: 40%;
      left: 40%;
      top: 36%;
      border: 1px solid red;
      .core {
        display: flex;
        justify-content: center;
        height: 40px;
        .submit {
          width: 120px;
          height: 36px;
          font-size: 18px;
          text-align: center;
          line-height: 36px;
          letter-spacing: 4px;
          background: linear-gradient(
            to right,
            #f5003d,
            pink,
            #ff3366,
            #ff6633
          );
          color: transparent;
          background-clip: text;
          &:hover {
            border-bottom: 2px solid pink;
          }
        }
      }
      input {
        display: block;
        line-height: 40px;
        font-size: 18px;
        width: 100%;
        border: none;
        outline: none;
        background-color: transparent;
        border-bottom: 2px solid pink;
      }
    }
  }
  .meetBox {
    width: 100%;
    height: 100%;
    .meet {
      position: absolute;
      width: 30%;
      height: 40%;
      left: 40%;
      top: 36%;
      color: palegoldenrod;
      .meetOnline {
        display: flex;
        padding: 0px 10px;
        height: 60px;
        align-items: center;
        .meetLeft {
          flex: 1;
          text-align: left;
          border-bottom: 1px solid pink;
        }
        .meetContent {
          flex: 1;
          text-align: center;
        }
        .meetRight {
          flex: 1;
          text-align: right;
          border-bottom: 1px solid pink;
        }
      }
      .meetLine{
        display: flex;
        height: 60px;
        align-items: center;
        .name{
          width: 100px;
          padding: 0px 10px;
        }
        .time{
          flex: 1;
          border-bottom: 1px solid pink;
        }
        .honoy{
          display: flex;
          justify-content: flex-start;
          flex: 1;
          border-bottom: 1px solid pink;
        }
      }
    }
  }
}
</style>
